class_name State_manager
extends Base1

var states_array:Array=[]
@onready var current :Base1=$Idle

func _ready():
	self.add_to_group("player")
	states_array=get_children()
	current.enter()
	pass

func _physics_process(delta):
	current.do()
	pass
#状态转换函数
func change_state(id:int)->void:
	current.exit() #老状态退出
	current=states_array[id]
	current.enter()
	pass
